package cn.tedu.recruitmentwebsite.common.controller;

import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;

@Controller
public class WebSocketController {
    @MessageMapping("/chat")
    @SendTo("/topic/messages")
    public String handleChatMessage(String message) {
        // 处理接收到的消息
        System.out.println("Received message: " + message);
        return message; // 将消息广播给所有订阅了 /topic/messages 的客户端
    }
}
